{% extends 'base.html' %}
{% block title %} Blog Post Detail Page {% endblock title %}

{% block content %}
<h1>{{ blogpost.title }}</h1>

{% if request.user.is_authenticated and request.user.id == blogpost.author.id %}
<a class="btn btn-primary btn-sm" href="{% url 'blog:edit' blogpost.slug %}">Edit</a>
<a class="btn btn-danger btn-sm" href="{% url 'blog:delete' blogpost.slug %}">Delete</a>
{% endif %}

<small>
  author:{{ blogpost.author.username }}
  {% if blogpost.published_at %}
  ,published at: {{ blogpost.published_at | date:'Y-m-d H:i' }}
  {% else %}
  <small>draft</small>
  {% endif %}
</small>
<hr />
<p>
  {{ blogpost.content }}
</p>

{% endblock content %}